package com.itheima.edu.info.manager.dao;

import com.itheima.edu.info.manager.domain.Student;



public class StudentDao {
    static private Student[] ArrayStudent = new Student[5];

    public boolean addStudent(Student stn) {
        boolean flog = false;
        for (int i = 0; i < ArrayStudent.length; i++) {
            if (ArrayStudent[i] == null) {
                ArrayStudent[i] = stn;
                flog = true;
                break;
            }
        }
        return flog;
    }

    public Student[] findAllStudent() {
        return ArrayStudent;
    }

    public void changeStudent(Student stn, int index) {
        ArrayStudent[index].setName(stn.getName());
        ArrayStudent[index].setAge(stn.getAge());
        ArrayStudent[index].setBirthday(stn.getBirthday());
    }
}

